﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections.ObjectModel;
using Medianamik.Core.Interfaces;

namespace Medianamik.Core
{
    public class RelationOptionCollection : KeyedCollection<Guid, IRelationOption>
    {
        protected override Guid GetKeyForItem(IRelationOption item)
        {
            return item.NodeId;
        }
    }
    public class RelationOptionEqualityComparer : IEqualityComparer<IRelationOption>
    {

        #region IEqualityComparer<IRelationOption> Members

        public bool Equals(IRelationOption x, IRelationOption y)
        {
            return GetHashCode(x).CompareTo(GetHashCode(y)) == 0;
        }

        public int GetHashCode(IRelationOption obj)
        {
            return obj.NodeId.GetHashCode();
        }

        #endregion
    }
}
